import cv2
import numpy as np

img = cv2.imread('img/example.png')

h, w, c = img.shape

gray_img = np.arange(h * w, dtype=np.uint8).reshape(h, w)
# gray_img = np.zeros((h, w, c), dtype=np.uint8)

for i in range(h):
    for j in range(w):
        gray_img[i, j] = img[i, j][0]*0.11 + img[i, j][1]*0.59 + img[i, j][2]*0.3

# gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# print(gray_img.shape)

cv2.imshow('', gray_img)
cv2.waitKey(0)